<template>
	<view class="uni-goods-nav">

		<view v-for="(item,index) in options" :key="index" class=" uni-tab__cart-button-left uni-tab__shop-cart"
			@click="onClick(index,item)" style="width: 250rpx;">
			<view class="" >
			  <image class="image" :src="item.icon" /> 
			</view>
			<text class="uni-tab__text">{{ item.text }}</text>
		</view>

	</view>

</template>

<script>
	import {
		initVueI18n
	} from '@dcloudio/uni-i18n'
	import messages from './i18n/index.js'
	const {
		t
	} = initVueI18n(messages)

	export default {
		name: 'UniGoodsNav',
		emits: ['click', 'buttonClick'],
		props: {
			options: {
				type: Array,
				default () {
					return [{
						icon: 'shop',
						text: t("uni-goods-nav.options.shop"),
					}, {
						icon: 'cart',
						text: t("uni-goods-nav.options.cart")
					}]
				}
			},
		
			fill: {
				type: Boolean,
				default: false
			}
		},
		methods: {
			onClick(index, item) {
				
				 
				if(index==0){
				this.$Router.push({ path: '/pages/store/index', query: { id: item.storeId } })
				}
				if(index==1){
				this.$Router.push({ path: '/pages/store/categroy', query: { id: item.storeId} })
				}
				if(index==2){
				this.$Router.push({ path: '/pages/store/list', query: { id: item.storeId} })
				}
				if(index==3){
				this.$Router.push({ path: '/pages/kefu/minikefu', query: { id: item.storeId} })
				}
			},
			buttonClick(index, item) {
				if (uni.report) {
					uni.report(item.text, item.text)
				}
				this.$emit('buttonClick', {
					index,
					content: item
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.flex {
 
		display: flex;
	 
		flex-direction: row;
	}

	.uni-goods-nav {
 
		display: flex;
 
		flex: 1;
		flex-direction: row;
	}

	.uni-tab__cart-box {
		flex: 1;
		height: 50rpx;
		background-color: #fff;
		z-index: 900;
	}

	.uni-tab__cart-sub-left {
		padding: 0 5rpx;
	}

	.uni-tab__cart-sub-right {
		flex: 1;
	}

	.uni-tab__right {
		margin: 5rpx 0;
		margin-right: 10rpx;
		border-radius: 100rpx;
		overflow: hidden;
	}

	.uni-tab__cart-button-left {
		display: flex;
		justify-content: center;
		align-items: center;
		flex-direction: column;
		cursor: pointer;
	 
	}

	.image {
		width: 48rpx;
		height: 48rpx;
		text-align: center;
	}

	.uni-tab__text {
		margin-top: 3rpx;
		font-size: 30rpx;
		color: #646566;
	}

	.uni-tab__cart-button-right {
		display: flex;
		flex-direction: column;
	
		flex: 1;
		justify-content: center;
		align-items: center;
	
		cursor: pointer;
	
	}

	.uni-tab__cart-button-right-text {
		font-size:30rpx;
		color: #fff;
	}

	.uni-tab__cart-button-right:active {
		opacity: 0.7;
	}

	.uni-tab__dot-box {
		
		display: flex;
		flex-direction: column;
	
		position: absolute;
		right: -2rpx;
		top: 2rpx;
		justify-content: center;
		align-items: center;
		// width: 0;
		// height: 0;
	}

	.uni-tab__dot {
		// width: 30rrpx;
		// height: 30rrpx;
		padding: 0 4rpx;
		line-height: 15rpx;
		color: #ffffff;
		text-align: center;
		font-size: 30rpx;
		background-color: #ff0000;
		border-radius: 15rpx;
	}

	.uni-tab__dots {
		padding: 0 4rpx;
		// width: auto;
		border-radius: 15rpx;
	}
</style>
